<template>
  <div>
    <h2 align="center">理财项目列表</h2>
    项目编号:<input type="text" v-model="showData.T_Id"/>
    项目名称:<input type="text" v-model="showData.T_Name"/>
    理财收益:<input type="text" v-model="showData.MinMoney"/>-
    <input type="text" v-model="showData.MaxMoney"/>
    <input type="button" value="查询" @click="showManage" class="btn btn-success">&nbsp; 
    <input type="button" value="批量删除" @click="DelByIds()" class="btn btn-danger">
    <table class="table table-bordered">
      <tr>
        <td><input type="checkbox"></td>
        <td>理财编号</td>
        <td>项目名称</td>
        <td>年收益</td>
        <td>月收益</td>
        <td>最低金额</td>
        <td>理财人数</td>
        <td>风险等级</td>
        <td>利息</td>
        <td>操作</td>
      </tr>

      <tr v-for="item in list" :key="item.T_Id">
        <td><input type="checkbox"></td>
        <td>{{ item.T_Id }}</td>
        <td>{{ item.T_Name }}</td>
        <td>{{ item.T_Year }}</td>
        <td>{{ item.T_Month }}</td>
        <td>{{ item.T_MinMoney }}</td>
        <td>{{ item.T_Number }}</td>
        <td>{{ item.T_Inves }}</td>
        <td>{{ item.G_Moneys.G_Name }}</td>
        <td></td>
      </tr>
    </table>
  </div>
</template>

<script setup lang="ts">

import {reactive,toRefs,onMounted } from 'vue'

import axios from 'axios';

import {useRouter,useRoute} from 'vue-router'

let router = useRouter()

//数据
let data:any =reactive({
  list:[],
  showData:{
    T_Id:'',
    T_Name:'',
    MinMoney:'',
    MaxMoney:'',
  }
})

let {list,showData} = toRefs(data)

onMounted(()=>{
  showManage()
})

//理财列表
const showManage=()=>{
  axios({
    url:'/api/TManage/ShowManage',
    method:'get',
    params:showData.value
  }).then(res=>{
    console.log(res);
    
    list.value = res.data.data
  }).catch(err=>{
    console.log(err);
  })
}

//批量删除
const DelByIds=()=>{
  //批量删除至少选择一项
  alert("至少选中一项")

  axios({
    url:'',
    method:'delete',
    params:{}
  }).then(res=>{
    if(res.data.code==200){
      showManage()
    }
  })
}

</script>

<style scoped>

</style>